{extend name="public/base"}

{block name="title"}
交易明细
{/block}

{block name="style"}
{css href="/static/wechat/css/wallet.css" /}
{/block}

{block name="body"}
<div class="pageControl tradeList">
    <div class="msui_nav msui_navTop">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">交易明细</h1>
    </div>
    <div class="weui-top">

    </div>
</div>
{/block}
{block name="javascript"}
<script>
    $(function () {
        var obj = {
            'is_more' : true,
            'page' : 1
        };
        get_order_list(obj.page);
        $(window).scroll( function() {
            if (($(document).height() - $(this).scrollTop() - $(this).height()<50) && obj.is_more){
                get_order_list();
            }
        });

        function get_order_list() {
            obj.is_more = false;
            $.ajax({
                type : 'POST',
                url : '?page=' + obj.page,
                dataType : 'json',
                success : function (msg) {
                    var datas = msg.data.data; // 列表数据
                    var len = datas.length; //
                    var html = [];
                    for (var i = 0; i < len; i++) {
                        console.log(datas[i].add_time);
                        var h = '<a href="tradeDetails.html">' +
                        '<div class="weui-form-preview">' +
                        '<div class="weui-form-preview__bd">' +
                        '<div class="weui-form-preview__item">' +
                        '<label class="weui-form-preview__label fs08 cl-9999">'+ datas[i].msg +'</label>' +
                        '<span class="weui-form-preview__value fs07 cl-9999">'+ getLocalTime(datas[i].add_time) +'</span>' +
                        '</div>' +
                        '<div class="weui-form-preview__item">' +
                        '<label class="weui-form-preview__label fs075 cl-3333">'+ datas[i].money +'</label>';
                        if(datas[i].type == 6 && datas[i].status == 0){
                            h +='<span class="weui-form-preview__value fs08 cl-yellow">审核中</span>';
                        } else if(datas[i].type == 6 && datas[i].status == 1){
                            h +='<span class="weui-form-preview__value fs08 cl-green">已审核</span>';
                        } else if(datas[i].type == 6 && datas[i].status == 2){
                            h +='<span class="weui-form-preview__value fs08 cl-orange">审核失败</span>';
                        }
                        h +='</div>' +
                        '</div>' +
                        '</div>' +
                        '</a>';

                        html.push(h)
                    }
                    $(".weui-top").append(html.join(''));

                    // 计算是否还有更多数据
                    if ((msg.data.total - (msg.data.current_page * msg.data.per_page)) > 0) {
                        obj.is_more = true;
                    }
                    obj.page++;
                }
            });
        }
    });


</script>
{/block}
